/*
 *-----------------------------------------------------------------------------
 * The confidential and proprietary information contained in this file may
 * only be used by a person authorised under and to the extent permitted
 * by a subsisting licensing agreement from  CHIPSEA.
 *
 *            (C) COPYRIGHT 2017 SHENZHEN CHIPSEA TECHNOLOGIES CO.,LTD.
 *                ALL RIGHTS RESERVED
 *
 * This entire notice must be reproduced on all copies of this file
 * and copies of this file may only be made by a person if such person is
 * permitted to do so under the terms of a subsisting license agreement
 * from CHIPSEA.
 *
 *      Release Information : CSA37FX61 
 *-----------------------------------------------------------------------------
 */

#include "compile_option.h"

#ifdef CS_F61

#ifndef __CSA37FX61_SYSTEM_H
#define __CSA37FX61_SYSTEM_H

#include "csa37fx61.h"
#include "absacc.h"
#include "csa37fx61_lib.h"

#define VS_PA0  0x0001
#define VS_PA1  0x0004
#define VS_PA2  0x0010
#define VS_PA3  0x0040
#define VS_PA4  0x0100
#define VS_PA5  0x0400
#define VS_PA6  0x1000
#define VS_PA7  0x4000
#define VS_PA8  0x10000
#define VS_PA9  0x40000


typedef enum
{ 
    HCLK_Div_2 = 0x00,
    HCLK_Div_4 = 0x01,
    HCLK_Div_8 = 0x02,
    HCLK_Div_16 = 0x03,
 
}TempSensorClk_TypeDef;

typedef enum
{ 
    MCU_Reset = 0x00,
    CPU_Reset = 0x01,
    Chip_Reset = 0x02,
 
}ResetMode_TypeDef;

typedef enum
{ 
    Reuse_PA0 = 0x00,
    Reuse_PA1 = 0x01,
    Reuse_PA2 = 0x02,
    Reuse_PA3 = 0x03,
    Reuse_PA4 = 0x04,
    Reuse_PA5 = 0x05,
    Reuse_PA6 = 0x06,
    Reuse_PA7 = 0x07,
    Reuse_PA8 = 0x08,
    Reuse_PA9 = 0x09,
    Reuse_PA10 = 0x0a,
    Reuse_PA11 = 0x0b,
    Reuse_PA12 = 0x0c,
    Reuse_PA13 = 0x0d,
    Reuse_PA14 = 0x0e,
    Reuse_PA15 = 0x0f,
 
}GPIO_Sel_TypeDef;

typedef enum
{ 
    GPIO_Mode = 0x00,
    UART_RXD = 0x01,
    UART_TXD = 0x02,
    I2C_SCL = 0x03,
    I2C_SDA = 0x04,
    AFE_CLK = 0x05,
    AFE_DAT = 0x06,
    SWDIO = 0x07,
    SWCLK = 0x08,
    
}GPIO_ReuseMode_TypeDef;

void Reg_WRProtDisable(void);
void Reg_WRProtEnable(void);
uint32_t System_ReadChipPDID(void);
uint32_t System_ReadChipCPUID(void);
uint32_t System_ReadChipRstSrc(void);
void System_ClearChipRstSrc(void);

void System_TempSensorInit( TempSensorClk_TypeDef TempSensor_Clk , FunctionalState NewState);
void System_TempSensorStartChange(void);
uint8_t System_TempSensorBusy(void);
uint16_t System_ReadTempSensorData(void);
void System_Reset(ResetMode_TypeDef Reset_Mode);
void System_SetGPIOReuse(GPIO_Sel_TypeDef GPIO_x, GPIO_ReuseMode_TypeDef Reuse_Mode);
void System_EnGPIOxOutputVS(uint32_t vs_pin);
void System_DisGPIOxOutputVS(uint32_t vs_pin);
#endif /* __CSA37FX61_SYSTEM_H */ 

#endif /* End of CS_F61 */
